/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sortstrategy;

import pattern.NameList;
import pattern.SortRandom;
import pattern.SortDescent;
import pattern.SortAscent;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author jccaicedo
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        System.out.println("BIENVENIDO");
        NameList lista = new NameList( new SortAscent() );
        for(int i = 0; i < 5; i++){
            System.out.print("Nombre " +  (i+1) + ": ");
            String nombre = leerNombre();
            lista.addName(nombre);
        }
        System.out.println(" ********** ASCENDENTE ********** ");
        lista.printList();
         System.out.println(" ********** DESCENDENTE ********** ");
        lista.printList( new SortDescent() );
         System.out.println(" ********** RANDOM ********** ");
        lista.printList( new SortRandom() );
    }

    private static String leerNombre(){
        BufferedReader reader = new BufferedReader( new InputStreamReader(System.in));
        String s = null;
        try{
            s = reader.readLine();
        }catch(IOException ex){
            ex.printStackTrace();
        }
        return s;
    }

}
